# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>

pkgname=aisleriot
pkgver=3.22.6
pkgrel=2
pkgdesc="A collection of patience games written in guile scheme"
url="https://wiki.gnome.org/Apps/Aisleriot"
arch=(x86_64)
license=(GPL)
depends=(guile gtk3 librsvg libcanberra dconf)
makedepends=(appdata-tools gnome-common git)
optdepends=('libkdegames: KDE card sets'
            'pysolfc: PySol card sets'
            'pysolfc-cardsets: PySol card sets')
options=(!emptydirs)
_commit=0bccad236d311a51995eed018a4563ad79b1a9e3  # tags/3.22.6^0
source=("git+https://gitlab.gnome.org/GNOME/aisleriot.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib \
    --disable-static \
    --with-platform=gtk-only \
    --with-kde-card-theme-path=/usr/share/carddecks \
    --with-pysol-card-theme-path=/usr/share/PySolFC

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
